#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Create by zhang
# Create on 2022/6/21 17:18
from domain.common.base_dto import BaseDTO
from domain.common.base_schema import BaseSchema
from domain.common.schema_item import SchemaItem
from domain.report.common.period_enum import PeriodEnum


class CashDTO(BaseDTO):
    """
    现金流量表DTO
    """
    def __init__(self):
        self.stock_id:int = None
        self.stock_code:str = None
        self.year:int = None
        self.period:PeriodEnum = None
        self.is_consolidate: bool = False

        self.cash_received_of_sales_service = None
        self.n_depos_incr_fi = None
        self.n_incr_loans_cb = None
        self.n_inc_borr_oth_fi = None
        self.prem_fr_orig_contr = None
        self.n_reinsur_prem = None
        self.n_incr_insured_dep = None
        self.n_incr_disp_tfa = None
        self.ifc_cash_incr = None
        self.n_incr_loans_oth_bank = None
        self.n_cap_incr_repur = None
        self.refund_of_tax_and_levies = None
        self.cash_received_of_other_operate = None
        self.sub_total_cash_in_operate = None
        self.c_paid_goods_s = None
        self.n_incr_clt_loan_adv = None
        self.n_incr_dep_cbob = None
        self.c_pay_claims_orig_inco = None
        self.pay_handling_chrg = None
        self.pay_comm_insur_plcy = None
        self.c_paid_to_for_empl = None
        self.payments_of_all_taxes = None
        self.other_cash_paid_to_operate = None
        self.sub_total_cash_out_operate = None
        self.n_cashflow_act = None
        self.cash_received_of_resume_invest = None
        self.invest_income_cash_received = None
        self.net_cash_of_disposal_assets = None
        self.net_cash_of_disposal_branch = None
        self.cash_received_of_other_invest = None
        self.sub_total_cash_in_invest = None
        self.c_pay_acq_const_fiolta = None
        self.invest_paid_cash = None
        self.n_incr_pledge_loan = None
        self.net_cash_remain_from_branch = None
        self.other_cash_paid_to_invest = None
        self.sub_total_cash_out_invest = None
        self.n_cashflow_invest_act = None
        self.cash_received_from_investor = None
        self.cash_received_of_absorb_invest = None
        self.cash_received_of_borrowing = None
        self.proc_issue_bonds = None
        self.cash_received_of_other_financing = None
        self.sub_total_cash_in_financing = None
        self.cash_pay_for_debt = None
        self.c_pay_dist_dpcp_int_exp = None
        self.incl_dvd_profit_paid_sc_ms = None
        self.other_cash_paid_to_financing = None
        self.sub_total_cash_out_financing = None
        self.n_cash_flows_fnc_act = None
        self.effect_of_exchange_change = None
        self.cash_equ_increase = None
        self.c_cash_equ_end_period = None


class CashSchema(BaseSchema):
    _schemas = [
        SchemaItem(name="stock_id", title="股票代码(数字)", value_type=str, is_must=True),
        SchemaItem(name="stock_code", title="股票代码（字符串，带交易所简称）", value_type=str, is_must=True),
        SchemaItem(name="stock_name", title="股票名称", value_type=str, is_must=True),
        SchemaItem(name="year", title="年份", value_type=int, is_must=True),
        SchemaItem(name="period", title="报表周期类型", value_type=PeriodEnum, is_must=True),
        SchemaItem(name="is_consolidate", title="是否是合并报表", value_type=bool, is_must=True),

        SchemaItem(name="cash_received_of_sales_service", title="销售商品提供劳务收到的现金", value_type=float, is_must=True),
        SchemaItem(name="n_depos_incr_fi", title="客户存款和同业存放款项净增加额", value_type=float, is_must=True),
        SchemaItem(name="n_incr_loans_cb", title="向中央银行借款净增加额", value_type=float, is_must=True),
        SchemaItem(name="n_inc_borr_oth_fi", title="向其他金融机构拆入资金净增加额", value_type=float, is_must=True),
        SchemaItem(name="prem_fr_orig_contr", title="收到原保险合同保费取得的现金", value_type=float, is_must=True),
        SchemaItem(name="n_reinsur_prem", title="收到再保险业务现金净额", value_type=float, is_must=True),
        SchemaItem(name="n_incr_insured_dep", title="保户储金及投资款净增加额", value_type=float, is_must=True),
        SchemaItem(name="n_incr_disp_tfa", title="处置交易性金融资产净增加额", value_type=float, is_must=True),
        SchemaItem(name="ifc_cash_incr", title="收取利息、手续费及佣金的现金", value_type=float, is_must=True),
        SchemaItem(name="n_incr_loans_oth_bank", title="拆入资金净增加额", value_type=float, is_must=True),
        SchemaItem(name="n_cap_incr_repur", title="回购业务资金净增加额", value_type=float, is_must=True),
        SchemaItem(name="refund_of_tax_and_levies", title="收到的税费返还", value_type=float, is_must=True),
        SchemaItem(name="cash_received_of_other_operate", title="收到的其他与经营活动有关的现金", value_type=float, is_must=True),
        SchemaItem(name="sub_total_cash_in_operate", title="经营活动现金流入小计", value_type=float, is_must=True),
        SchemaItem(name="c_paid_goods_s", title="购买商品接受劳务支付的现金", value_type=float, is_must=True),
        SchemaItem(name="n_incr_clt_loan_adv", title="客户贷款及垫款净增加额", value_type=float, is_must=True),
        SchemaItem(name="n_incr_dep_cbob", title="存放中央银行和同业款项净增加额", value_type=float, is_must=True),
        SchemaItem(name="c_pay_claims_orig_inco", title="支付原保险合同赔付款项的现金", value_type=float, is_must=True),
        SchemaItem(name="pay_handling_chrg", title="支付利息、手续费及佣金的现金", value_type=float, is_must=True),
        SchemaItem(name="pay_comm_insur_plcy", title="支付保单红利的现金", value_type=float, is_must=True),
        SchemaItem(name="c_paid_to_for_empl", title="支付给职工以及为职工支付的现金", value_type=float, is_must=True),
        SchemaItem(name="payments_of_all_taxes", title="支付的各项税费", value_type=float, is_must=True),
        SchemaItem(name="other_cash_paid_to_operate", title="支付的其他与经营活动有关的现金", value_type=float, is_must=True),
        SchemaItem(name="sub_total_cash_out_operate", title="经营活动现金流出小计", value_type=float, is_must=True),
        SchemaItem(name="n_cashflow_act", title="经营活动现金流量净额", value_type=float, is_must=True),
        SchemaItem(name="cash_received_of_resume_invest", title="收回投资所收到的现金", value_type=float, is_must=True),
        SchemaItem(name="invest_income_cash_received", title="取得投资收益所收到的现金", value_type=float, is_must=True),
        SchemaItem(name="net_cash_of_disposal_assets", title="处置固定资产、无形资产和其他长期资产而收回的现金", value_type=float, is_must=True),
        SchemaItem(name="net_cash_of_disposal_branch", title="收回投资所收到的现金中的出售子公司收到的现金", value_type=float, is_must=True),
        SchemaItem(name="cash_received_of_other_invest", title="收到的其他与投资活动有关的现金", value_type=float, is_must=True),
        SchemaItem(name="sub_total_cash_in_invest", title="投资活动现金流入小计", value_type=float, is_must=True),
        SchemaItem(name="c_pay_acq_const_fiolta", title="购建固定资产、无形资产和其他长期资产所支付的现金", value_type=float, is_must=True),
        SchemaItem(name="invest_paid_cash", title="投资所支付的现金", value_type=float, is_must=True),
        SchemaItem(name="n_incr_pledge_loan", title="质押贷款净增加额", value_type=float, is_must=True),
        SchemaItem(name="net_cash_remain_from_branch", title="取得子公司及其他营业单位支付的现金净额", value_type=float, is_must=True),
        SchemaItem(name="other_cash_paid_to_invest", title="支付的其他与投资活动有关的现金", value_type=float, is_must=True),
        SchemaItem(name="sub_total_cash_out_invest", title="投资活动现金流出小计", value_type=float, is_must=True),
        SchemaItem(name="n_cashflow_invest_act", title="投资活动产生的现金流量净额", value_type=float, is_must=True),
        SchemaItem(name="cash_received_from_investor", title="吸收投资所收到的现金", value_type=float, is_must=True),
        SchemaItem(name="cash_received_of_absorb_invest", title="吸收投资所收到的现金中的子公司吸收少数股东权益性投资收到的现金", value_type=float, is_must=True),
        SchemaItem(name="cash_received_of_borrowing", title="借款所收到的现金", value_type=float, is_must=True),
        SchemaItem(name="proc_issue_bonds", title="发行债券所收到的现金", value_type=float, is_must=True),
        SchemaItem(name="cash_received_of_other_financing", title="收到其他与筹资活动有关的现金", value_type=float, is_must=True),
        SchemaItem(name="sub_total_cash_in_financing", title="筹资活动现金流入小计", value_type=float, is_must=True),
        SchemaItem(name="cash_pay_for_debt", title="偿还债务所支付的现金", value_type=float, is_must=True),
        SchemaItem(name="c_pay_dist_dpcp_int_exp", title="分配股利利润或偿付利息所支付的现金", value_type=float, is_must=True),
        SchemaItem(name="incl_dvd_profit_paid_sc_ms", title="分配股利利润或偿付利息所支付的现金中的支付少数股东的股利", value_type=float, is_must=True),
        SchemaItem(name="other_cash_paid_to_financing", title="支付的其他与筹资活动有关的现金", value_type=float, is_must=True),
        SchemaItem(name="sub_total_cash_out_financing", title="筹资活动现金流出小计", value_type=float, is_must=True),
        SchemaItem(name="n_cash_flows_fnc_act", title="筹资活动产生的现金流量净额", value_type=float, is_must=True),
        SchemaItem(name="effect_of_exchange_change", title="汇率变动对现金的影响", value_type=float, is_must=True),
        SchemaItem(name="cash_equ_increase", title="现金及现金等价物净增加额", value_type=float, is_must=True),
        SchemaItem(name="c_cash_equ_end_period", title="期末现金及现金等价物余额", value_type=float, is_must=True),

        SchemaItem(name="branch_paid_to_minority_holder", title="子公司支付给少数股东的股利", value_type=float, is_must=True),
        SchemaItem(name="c_cash_equ_start_period", title="期初现金及现金等价物余额", value_type=float, is_must=True)
    ]

    _name2schema = {}

    _title2name = {}